﻿@using Newtouch.Infrastructure
@{
    ViewBag.title = "SSForm";
    Layout = "~/Views/Shared/_Form.cshtml";
}
<style>
    .form .formTitle {
        width: 80px;
        padding-right: 5px;
    }

    .radio input[type=radio], .radio-inline input[type=radio] {
        margin-left: -16px;
    }

    .radio-inline {
        line-height: 22px;
        margin-left: 30px;
        width: 35px;
    }
</style>

<form id="form1">
    <div style="padding-top: 10px; margin-right: 20px;margin-left: 10px;">
        <table class="form">
            <tr>
                <td class="formTitle"><input id="ryrq" name="ryrq" type="text" hidden="hidden" /><input id="cyrq" name="cyrq" type="text" hidden="hidden" /></td>
                <td class="formValue">
                    <input id="scltexthidden" name="srltexthidden" hidden="hidden" type="text" />
                </td>
                <td class="formTitle"><input id="srltexthidden" hidden="hidden" name="srltexthidden" type="text" /></td>
                <td class="formValue"></td>
                <td class="formTitle"></td>
                <td class="formValue"></td>
                <td class="formTitle"></td>
                <td class="formValue"></td>
            </tr>
            <tr>
                <td class="formTitle"><span class="required">*</span>住院号：</td>
                <td class="formValue">
                    <input id="zyh" name="zyh" type="text" readonly="readonly" class="form-control required" placeholder="" />
                </td>
                <td class="formTitle"><span class="required">*</span>姓名：</td>
                <td class="formValue">
                    <input id="xm" name="xm" type="text" readonly="readonly" class="form-control required" placeholder="" />
                </td>
                <td class="formTitle"><span class="required">*</span>日期：</td>
                <td class="formValue">
                    <input id="rq" name="rq" type="text" class="required form-control input-wdatepicker formClearIgnore" onfocus="WdatePicker()" value="@DateTime.Now.ToString("yyyy-MM-dd")">
                </td>
                <td class="formTitle"><span class="required">*</span>时间点：</td>
                <td class="formValue">
                    <input id="sj" name="sj" type="text" class="required form-control input-wdatepicker formClearIgnore" onfocus="WdatePicker({ dateFmt: 'HH:mm' })" value="@DateTime.Now.ToString("HH:mm")">
                </td>
            </tr>
            <tr>
                <td class="formTitle">体温：</td>
                <td class="formValue">
                    <input id="tw" name="tw" type="text" onkeyup="this.value=this.value.replace(/[^\-?\d.]/g,'')" class="form-an form-control" placeholder="" />
                </td>
                <td class="formTitle">血氧饱和度：</td>
                <td class="formValue">
                    <input id="xybhd" name="xybhd" type="text" onkeyup="this.value=this.value.replace(/[^\-?\d.]/g,'')" class="form-an form-control" placeholder="" />
                </td>
                <td class="formTitle">呼吸频率：</td>
                <td class="formValue">
                    <input id="hxpl" name="hxpl" type="text" onkeyup="this.value=this.value.replace(/[^\-?\d.]/g,'')" class="form-an form-control" placeholder="" />
                </td>
                <td class="formTitle">脉率：</td>
                <td class="formValue">
                    <input id="ml" name="ml" type="text" onkeyup="this.value=this.value.replace(/[^\-?\d.]/g,'')" class="form-an form-control" placeholder="" />
                </td>
            </tr>
            <tr>
                <td class="formTitle">收缩压：</td>
                <td class="formValue">
                    <input id="ssy" name="ssy" type="text" onkeyup="this.value=this.value.replace(/[^\-?\d.]/g,'')" class="form-an form-control" placeholder="" />
                </td>
                <td class="formTitle">舒张压：</td>
                <td class="formValue">
                    <input id="szy" name="szy" type="text" onkeyup="this.value=this.value.replace(/[^\-?\d.]/g,'')" class="form-an form-control" placeholder="" />
                </td>
                <td class="formTitle">吸氧(L/min)：</td>
                <td class="formValue">
                    <input id="xy" name="xy" type="text" onkeyup="this.value=this.value.replace(/[^\-?\d.]/g,'')" class="form-an form-control" placeholder="" />
                </td>
                <td class="formTitle">体重：</td>
                <td class="formValue">
                    <input id="tz" name="tz" type="text" onkeyup="this.value=this.value.replace(/[^\-?\d.]/g,'')" class="form-an form-control" placeholder="" />
                </td>
                @*<td class="formValue" colspan="2" style="padding-left:40px;">
            <div class="ckbox">
                <input id="zbdmbz" name="zbdmbz" type="checkbox"><label for="zbdmbz">足背动脉搏动</label>
            </div>
        </td>*@
            </tr>
            <tr>
                <td class="formTitle">瞳孔-左：</td>
                <td class="formValue">
                    <input id="tk_z" name="tk_z" type="text" onkeyup="this.value=this.value.replace(/[^\-?\d.]/g,'')" class="form-an form-control" placeholder="" />
                </td>
                <td class="formTitle">瞳孔-右：</td>
                <td class="formValue">
                    <input id="tk_y" name="tk_y" type="text" onkeyup="this.value=this.value.replace(/[^\-?\d.]/g,'')" class="form-an form-control" placeholder="" />
                </td>
                <td class="formTitle">对光反应-左：</td>
                <td class="formValue">
                    <input id="dgfs_z" name="dgfs_z" type="text" onkeyup="this.value=this.value.replace(/[^\-?\d.]/g,'')" class="form-an form-control" placeholder="" />
                </td>
                <td class="formTitle">对光反应-右：</td>
                <td class="formValue">
                    <input id="dgfs_y" name="dgfs_y" type="text" onkeyup="this.value=this.value.replace(/[^\-?\d.]/g,'')" class="form-an form-control" placeholder="" />
                </td>
            </tr>
            <tr>
                <td class="formTitle">意识：</td>
                <td class="formValue">
                    <input id="ys" name="ys" type="text" class="form-an form-control" placeholder="" />
                </td>
                <td class="formTitle">体位护理：</td>
                <td class="formValue">
                    <input id="twhl" name="twhl" type="text" class="form-an form-control" placeholder="" />
                </td>
                <td class="formTitle">皮肤护理：</td>
                <td class="formValue">
                    <input id="pfhl" name="pfhl" type="text" class="form-an form-control" placeholder="" />
                </td>
                <td class="formTitle">营养护理：</td>
                <td class="formValue">
                    <input id="yyhl" name="yyhl" type="text" class="form-an form-control" placeholder="" />
                </td>
            </tr>
            <tr>
                <td class="formTitle">护理等级：</td>
                <td class="formValue">
                    <select id="hldj" name="hldj" class="form-control">
                        <option value="">==请选择==</option>
                        <option value="1">特级护理</option>
                        <option value="2">一级护理</option>
                        <option value="3">二级护理</option>
                        <option value="4">三级护理</option>
                    </select>
                </td>
                <td class="formTitle">护理类型：</td>
                <td class="formValue">
                    <select id="hllx" name="hllx" class="form-control">
                        <option value="">==请选择==</option>
                        <option value="1">基础护理</option>
                        <option value="2">特殊护理</option>
                        <option value="3">辩证施护</option>
                        <option value="4">其他</option>
                    </select>
                </td>
                <td class="formTitle">饮食情况：</td>
                <td class="formValue">
                    <select id="ysqk" name="ysqk" class="form-control">
                        <option value="">==请选择==</option>
                        <option value="1">良好</option>
                        <option value="2">一般</option>
                        <option value="3">较差</option>
                    </select>
                </td>
                <td class="formTitle">气管护理：</td>
                <td class="formValue">
                    <select id="qghl" name="qghl" class="form-control">
                        <option value="">==请选择==</option>
                        <option value="1">翻身拍背</option>
                        <option value="2">雾化吸入</option>
                        <option value="3">吸痰</option>
                    </select>
                </td>
            </tr>
            <tr>
                <td class="formTitle">饮食指导：</td>
                <td class="formValue">
                    <select id="yszd" name="yszd" class="form-control">
                        <option value="">==请选择==</option>
                        <option value="01">普通饮食</option>
                        <option value="02">软食</option>
                        <option value="03">半流食</option>
                        <option value="04">流食</option>
                        <option value="05">禁食</option>
                        <option value="06">禁食水</option>
                        <option value="07">鼻饲饮食</option>
                        <option value="08">低盐低脂饮食</option>
                        <option value="09">糖尿病饮食</option>
                        <option value="99">其他</option>
                    </select>
                </td>
                <td class="formTitle">心理护理：</td>
                <td class="formValue">
                    <select id="xlhl" name="xlhl" class="form-control">
                        <option value="">==请选择==</option>
                        <option value="1">根据病人心理状况实施心理护理</option>
                        <option value="2">家属心理支持</option>
                    </select>
                </td>
                <td class="formTitle">安全护理：</td>
                <td class="formValue">
                    <select id="aqhl" name="aqhl" class="form-control">
                        <option value="">==请选择==</option>
                        <option value="1">勤巡视病房</option>
                        <option value="2">加床档</option>
                        <option value="3">约束四肢</option>
                    </select>
                </td>
            </tr>
            @*<tr>
            <td class="formTitle">护理操作名称：</td>
            <td class="formValue">
                <input id="hlczmc" name="hlczmc" type="text" class="form-an form-control" placeholder="" />
            </td>
            <td class="formTitle" colspan="2">护理观察项目名称：</td>
            <td class="formValue">
                <input id="hlgcxm" name="hlgcxm" type="text" class="form-an form-control" placeholder="" />
            </td>
            <td class="formTitle" colspan="2">护理操作项目类目名称：</td>
            <td class="formValue">
                <input id="hlczxmmc" name="hlczxmmc" type="text" class="form-an form-control" placeholder="" />
            </td>
        </tr>*@
            <tr style="display:none;">
                <td class="formValue" colspan="2" style="padding-left:40px;">
                    <div class="ckbox">
                        <input id="fcssaqb" name="fcssaqb" type="checkbox"><label for="fcssaqb">发出手术安全核对表</label>
                    </div>
                </td>
                <td class="formValue" colspan="2" style="padding-left:40px;">
                    <div class="ckbox">
                        <input id="shssaqb" name="shssaqb" type="checkbox"><label for="shssaqb">收回手术安全核对表</label>
                    </div>
                </td>
                <td class="formValue" colspan="2" style="padding-left:40px;">
                    <div class="ckbox">
                        <input id="fcssfxpgb" name="fcssfxpgb" type="checkbox"><label for="fcssfxpgb">发出手术风险评估表</label>
                    </div>
                </td>
                <td class="formValue" colspan="2" style="padding-left:40px;">
                    <div class="ckbox">
                        <input id="shssfxpgb" name="shssfxpgb" type="checkbox"><label for="shssfxpgb">收回手术风险评估表</label>
                    </div>
                </td>
            </tr>
            <tr>
                <td class="formTitle">摄入量：</td>
                <td class="formValue">
                    <input type="button" id="btn_srlbj" onclick="srlbj()" class="btn btn-primary" value="编辑" />
                </td>
                <td class="formTitle">摄出量：</td>
                <td class="formValue">
                    <input type="button" id="btn_sclbj" onclick="sclbj()" class="btn btn-primary" value="编辑" />
                </td>
            </tr>
            <tr>
                <td class="formTitle">摄入量：</td>
                <td class="formValue" colspan="7">
                    <input id="srltext" name="srltext" readonly="readonly" type="text" class="form-an form-control" placeholder="" />
                </td>
            </tr>
            <tr>
                <td class="formTitle">摄出量：</td>
                <td class="formValue" colspan="7">
                    <input id="scltext" name="scltext" readonly="readonly" type="text" class="form-an form-control" placeholder="" />
                </td>
            </tr>
            @*<tr>
            <td class="formValue" colspan="2" style="padding-left:40px;">
                <div class="ckbox">
                    <input id="glbz" name="glbz" type="checkbox"><label for="glbz">隔离标志</label>
                </div>
            </td>
            <td class="formTitle">隔离种类：</td>
            <td class="formValue">
                <select id="glzl" name="glzl" class="form-control">
                    <option value="">==请选择==</option>
                    <option value="1">消化道隔离</option>
                    <option value="2">呼吸道隔离</option>
                    <option value="3">接触隔离</option>
                    <option value="4">血液-体液隔离</option>
                    <option value="5">严密隔离</option>
                    <option value="6">昆虫隔离</option>
                    <option value="7">保护性隔离</option>
                </select>
            </td>
        </tr>*@
            <tr>
                <td class="formTitle">病情观察及措施：</td>
                <td class="formValue" colspan="7">
                    <textarea id="hlgcjg" class="form-an-end form-control"></textarea>
                </td>
            </tr>
            <tr style="display:none;">
                <td class="formTitle">护理操作结果：</td>
                <td class="formValue" colspan="7">
                    <textarea id="hlczjg" class="form-an-end form-control"></textarea>
                </td>
            </tr>
            <tr style="display:none;">
                <td class="formTitle">过敏史：</td>
                <td class="formValue" colspan="7">
                    <textarea id="gms" class="form-an-end form-control"></textarea>
                </td>
            </tr>
            <tr style="display:none;">
                <td class="formTitle">导管护理描述：</td>
                <td class="formValue" colspan="7">
                    <textarea id="dghl" class="form-an-end form-control"></textarea>
                </td>
            </tr>
            @*<tr>
            <td class="formTitle">简要病情：</td>
            <td class="formValue" colspan="7">
                <textarea id="jybq" class="form-an-end form-control"></textarea>
            </td>
        </tr>*@
            <tr>
                <td class="formTitle">护士签名：</td>
                <td class="formValue">
                    <input id="hsqm" name="hsqm" type="text" class="form-an form-control" value="@ViewBag.hsqm" />
                </td>
            </tr>
        </table>
    </div>
</form>
<div style="padding-left: 10px;margin-top: 10px;">
    <span style="color:red;">说明：</span>血压测量单位：mmHg；摄入摄出测量单位：ml；体温：℃；体重：kg；体重：kg；呼吸频率：次/分；脉率：次/分；血氧饱和度：%；
</div>
<script type="text/javascript">
    var keyValue = $.request("smtzId");
    var zyh = $.request("zyh");
    var xm = $.request("xm");
    $(function () {
        $('#xm').val(xm);
        initControl();
        if (!!keyValue) {
            $.ajax({
                url: "/MedicalRecordManage/NursingRecord/GetFormJsonSS",
                data: { keyValue: keyValue },
                dataType: "json",
                async: false,
                success: function (data) {
                    $("#form1").formSerialize(data);
                    $('#zyh').attr('data-zyh', data.zyh);
                    $('#rq').val($.getDate({ date: data.rq }));
                }
            });
            $.ajax({
                url: "/MedicalRecordManage/NursingRecord/GetSrlScl",
                data: { zyh: zyh, rq: $('#rq').val(), sj: $('#sj').val(), bllx: "2" },
                dataType: "json",
                async: false,
                success: function (data) {
                    if (data) {
                        var srlstr = "";
                        var srlstrxs = "";
                        for (var i = 0; i < data.length; i++) {
                            srlstr += data[i].mc + "|" + data[i].ml + "|" + data[i].dw + "|" + data[i].tj + ",";
                            srlstrxs += "名称:【" + data[i].mc + "】量:【" + data[i].ml + "】单位:【" + data[i].dw + "】途径 :【" + data[i].tj + "】,";
                        }
                        srlstr = srlstr.substring(0, srlstr.length - 1);
                        $("#srltext").val(srlstrxs);
                        $("#srltexthidden").val(srlstr);
                    }
                }
            });
            $.ajax({
                url: "/MedicalRecordManage/NursingRecord/GetScl",
                data: { zyh: zyh, rq: $('#rq').val(), sj: $('#sj').val(), bllx: "2" },
                dataType: "json",
                async: false,
                success: function (data) {
                    if (data) {
                        var srlstr = "";
                        var srlstrxs = "";
                        for (var i = 0; i < data.length; i++) {
                            srlstr += data[i].mc + "|" + data[i].ml + "|" + data[i].dw + "|" + data[i].ysxz + ",";
                            srlstrxs += "名称:【" + data[i].mc + "】量:【" + data[i].ml + "】单位:【" + data[i].dw + "】颜色形状 :【" + data[i].ysxz + "】,";
                        }
                        srlstr = srlstr.substring(0, srlstr.length - 1);
                        $("#scltext").val(srlstrxs);
                        $("#scltexthidden").val(srlstr);
                    }
                }
            });
        }
        if (zyh != null && zyh != "" && zyh != undefined) {
            $('#zyh').val(zyh);
            $('#zyh').attr('data-zyh', zyh);
            $.ajax({
                url: "/MedicalRecordManage/NursingRecord/Getzyhrq",
                data: { zyh: zyh },
                async: false,
                success: function (req) {
                    if (req != null) {
                        $("#ryrq").val(req);
                    } 
                }
            });
            $.ajax({
                url: "/MedicalRecordManage/NursingRecord/Getzyhcqrq",
                data: { zyh: zyh },
                async: false,
                success: function (req) {
                    if (req != null) {
                        $("#cyrq").val(req);
                    }
                }
            });
        }
    });

    function initControl() {

    }
</script>
<script type="text/javascript">
    function srlbj() {
        $.modalOpen({
            id: "OpenOutForm",
            title: "摄入量录入",
            url: "/MedicalRecordManage/NursingRecord/OpenOutForm?zyh=" + $('#zyh').val() + "&rq=" + $('#rq').val() + "&sj=" + $('#sj').val() + "&xm=" + $('#xm').val() + "&bllx=2" + "&srscl=" + $("#srltexthidden").val(),
            width: "700px",
            height: "600px",
            callBack: function (iframeId) {
                var ret = top.frames[iframeId].AcceptClick(function (srlstr) {
                    if (srlstr != "") {
                        var srlstrxs = "";
                        for (var i = 0; i < srlstr.split(",").length; i++) {
                            srlstrxs += "名称:【" + srlstr.split(",")[i].split("|")[0] + "】量:【" + srlstr.split(",")[i].split("|")[1] + "】单位:【" + srlstr.split(",")[i].split("|")[2] + "】途径 :【" + srlstr.split(",")[i].split("|")[3] + "】,";
                        }
                        $("#srltext").val(srlstrxs);
                        $("#srltexthidden").val(srlstr);
                    }
                });
            }
        });
    }
    function sclbj() {
        $.modalOpen({
            id: "OpenPutForm",
            title: "摄出量录入",
            url: "/MedicalRecordManage/NursingRecord/OpenPutForm?zyh=" + $('#zyh').val() + "&rq=" + $('#rq').val() + "&sj=" + $('#sj').val() + "&xm=" + $('#xm').val() + "&bllx=2" + "&srscl=" + $("#scltexthidden").val(),
            width: "700px",
            height: "600px",
            callBack: function (iframeId) {
                var ret = top.frames[iframeId].AcceptClick(function (sclstr) {
                    if (sclstr != "") {
                        var srlstrxs = "";
                        for (var i = 0; i < sclstr.split(",").length; i++) {
                            srlstrxs += "名称:【" + sclstr.split(",")[i].split("|")[0] + "】量:【" + sclstr.split(",")[i].split("|")[1] + "】单位:【" + sclstr.split(",")[i].split("|")[2] + "】颜色形状 :【" + sclstr.split(",")[i].split("|")[3] + "】,";
                        }
                        $("#scltext").val(srlstrxs);
                        $("#scltexthidden").val(sclstr);
                    }
                });
            }
        });
    }
    bindItemFloator("tzclbz", "WeightMemo");
    //bindItemFloator("dbcsbz", "DefecationFreqMemo");
    bindItemFloator("xyfs", "OxygenUptakeMed");
    function bindItemFloator(inputId, itemType) {
        //绑定字典
        $("#" + inputId).newtouchFloatingSelector({
            height: 200,
            width: 330,
            clickautotrigger: true,
            filter: function (keyword) {
                return $.itemDetails.getItems(itemType);
            },
            colModel: [
                { label: '编码', name: 'Code', widthratio: 20 },
                { label: '名称', name: 'Name', widthratio: 60 },
            ],
            itemdbclickhandler: function ($thistr, $thisinput) {
                //保存时验证val和data-Name一致
                $thisinput.attr('data-Code', $thistr.attr('data-Code'));
                $thisinput.attr('data-Name', $thistr.attr('data-Name'));
                $thisinput.val($thistr.attr('data-Name'));
            }
        });
    }
</script>
<script type="text/javascript">
    function AcceptClick(callback) {
        if ($.trim($('#zyh').val()) == '' || $('#zyh').val() != $('#zyh').attr('data-zyh')) {
            $.modalAlert("请选择住院患者", "warning");
            return;
        }
        if (!$("#form1").formValid()) {
            return;
        }

        var data = $("#form1").formSerialize();
        if (data.rq < $("#ryrq").val()) {
            $.modalAlert("录入日期不能小于入院日期!", "warning");
            return;
        }
        if ($("#cyrq").val() != null && $("#cyrq").val() != "") {
            if (data.rq > $("#cyrq").val()) {
                $.modalAlert("录入日期不能大于出院日期!", "warning");
                return;
            }
        }
        if ($('#srltext').val() != "") {
            $.ajax({
                url: "/MedicalRecordManage/NursingRecord/SubmitSrl?srlstr=" + $('#srltexthidden').val() + "&zyh=" + $('#zyh').val() + "&rq=" + $('#rq').val() + "&sj=" + $('#sj').val() + "&bllx=2",
                dataType: "json",
                async: false,
                success: function (data) {
                }
            });
        }
        if ($('#scltext').val() != "") {
            $.ajax({
                url: "/MedicalRecordManage/NursingRecord/SubmitScl?srlstr=" + $('#scltexthidden').val() + "&zyh=" + $('#zyh').val() + "&rq=" + $('#rq').val() + "&sj=" + $('#sj').val() + "&bllx=2",
                dataType: "json",
                async: false,
                success: function (data) {

                }
            });
        }
        $.submitForm({
            url: "/MedicalRecordManage/NursingRecord/SubmitFormSS?keyValue=" + keyValue,
            param: data,
            close: false,
            success: function () {
                newtouch_globalevent_f4();
                //保存成功回调
                callback();
                if (true) {
                    //setTimeout("$('#zyh').trigger('click');", 2500);
                }
            }
        })

    }

</script>